/* stylelint-disable max-nesting-depth */
@import "~scss/variables";
@import "~scss/mixins";

.sw-flow-sequence-condition {
    position: relative;
    display: grid;
    grid-template-columns: min-content;
    grid-template-rows: min-content;

    &__container {
        grid-column: 1;
        grid-row: 1;
        width: 322px;
    }

    &__true-arrow {
        grid-column: 2;
        grid-row: 1;
        position: relative;
        width: 100%;
        min-width: 100px;
        top: 40px;

        &.has--true-action {
            width: 110px;
        }

        .icon--regular-chevron-right-s {
            position: absolute;
            top: -7px;
            right: 0;
            color: $color-gray-500;
        }

        &.is--disabled {
            .arrow-action {
                &.sw-context-button .sw-context-button__button {
                    background: $color-white;
                    color: $color-darkgray-200;
                    border: 1px solid $color-gray-500;
                }
            }

            .sw-flow-sequence-condition__true-action {
                &.sw-context-button {
                    right: -13px;
                }
            }

            .sw-flow-sequence-condition__true-label {
                left: 50px;
            }
        }
    }

    &__oval {
        @include circle(12px);

        position: absolute;
        background: $color-white;
        border: 1px solid $color-gray-400;
        top: -6px;
        left: -7px;
    }

    &__true-arrow &__oval {
        left: -6px;
    }

    &__true-label {
        transform: translate(-50%, -50%);
        left: 50px;

        &.sw-label {
            background: $color-emerald-700;
            color: $color-white;
            border: none;
            font-weight: $font-weight-semi-bold;
            line-height: 16px;
        }
    }

    &__false-arrow {
        grid-column: 1;
        grid-row: 2;
        position: relative;
        left: 50%;
        height: 100%;
        min-height: 70px;
        width: 50%;

        &.has--false-action {
            height: 70px;
        }

        .icon--regular-chevron-down-s {
            position: absolute;
            bottom: 0;
            left: -9px;
            color: $color-gray-500;
        }

        &.is--disabled {
            .arrow-action {
                &.sw-context-button .sw-context-button__button {
                    background: $color-white;
                    color: $color-darkgray-200;
                    border: 1px solid $color-gray-500;
                }
            }
        }
    }

    &__false-label {
        top: 36px;
        transform: translate(-50%, -50%);

        &.sw-label {
            background: $color-crimson-600;
            color: $color-white;
            border: none;
            font-weight: $font-weight-semi-bold;
            line-height: 16px;
        }
    }

    .arrow-action {
        &.sw-context-button .sw-context-button__button {
            @include circle(24px);
            @include flex-centering;

            padding: 0;
            border: 1px solid $color-gray-500;
            background: $color-white;

            &:hover,
            &:focus {
                background: $color-gray-100;
            }
        }

        .mt-icon {
            display: inline-block;
            padding: 0;

            @include size(12px);
        }
    }

    &__true-line {
        border-top: 2px dashed $color-gray-400;
        height: 2px;
        width: calc(100% - 6px);
        position: absolute;
    }

    &__false-line {
        border-left: 2px dashed $color-gray-400;
        height: calc(100% - 6px);
        position: absolute;
        left: -2px;
    }

    &__true-action {
        &.sw-context-button {
            top: -11px;
            right: 0;
            position: absolute;
        }
    }

    &__false-action {
        &.sw-context-button {
            bottom: -14px;
            left: -13px;
            position: absolute;
        }
    }

    &__card {
        max-width: 322px;
        background: $color-white;
        border-radius: 8px;
        border: 1px solid $color-gray-300;
        box-shadow: 0 3px 6px 0 rgba(120, 138, 155, 20%);
        grid-row: span 1;
        overflow: hidden;
        transition: all 100ms ease-in-out;

        &:hover {
            box-shadow: 0 6px 10px 0 rgba(120, 138, 155, 20%);
        }
    }

    &__header {
        display: flex;
        padding: 16px 12px 12px 20px;
        justify-content: space-between;
        align-items: baseline;
        border-bottom: 1px solid $color-gray-300;
    }

    &__title-description {
        display: flex;
        gap: 4px;
    }

    &__title {
        font-size: $font-size-xs;
        font-weight: $font-weight-semi-bold;
        color: $color-darkgray-200;
        margin-bottom: 0;
    }

    &__description {
        font-size: $font-size-xs;
        font-weight: $font-weight-semi-bold;
        color: $color-darkgray-200;
        margin-bottom: 0;
    }

    &__rule {
        min-height: 52px;
    }

    &__rule-empty {
        @include flex-centering-vertical;

        padding: 16px 23px;

        .mt-icon {
            color: $color-gray-500;
        }
    }

    &__no-rule {
        color: $color-gray-400;
        font-size: $font-size-xs;
        font-weight: $font-weight-semi-bold;
        margin-left: 8px;
    }

    &__rule-info {
        padding: 12px 12px 16px 20px;

        p {
            font-size: $font-size-xs;
            color: $color-darkgray-200;
            margin-left: 20px;
        }
    }

    &__rule-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 4px;
    }

    &__rule-icon {
        align-self: baseline;
    }

    &__rule-name {
        overflow: hidden;
        word-wrap: break-word;
        flex-basis: 100%;

        h3 {
            font-size: $font-size-xs;
            font-weight: $font-weight-semi-bold;
            color: $color-darkgray-200;
            margin-bottom: 0;
            margin-left: 8px;
        }
    }

    &__rule-description {
        font-size: $font-size-xs;
        line-height: $line-height-sm;
        margin-left: 20px;
    }

    &__add-rule {
        border-top: 1px solid $color-gray-300;
        height: 56px;
        display: flex;
    }

    &__select {
        @include flex-centering-vertical;

        padding: 16px 24px;
        border-top: 1px solid $color-gray-300;
        width: 100%;
    }

    &__explains {
        position: absolute;
        width: 340px;
        left: 360px;
        padding: 24px;
        border: 2px dashed $color-gray-300;
        border-radius: 8px;
        color: $color-darkgray-200;
        top: 0;

        h4 {
            font-weight: $font-weight-semi-bold;
            color: $color-darkgray-200;
            margin-bottom: 12px;
        }

        p {
            font-size: $font-size-xs;
            line-height: $line-height-sm;
            color: $color-darkgray-200;
        }
    }
}

.sw-select-result-list-popover-wrapper {
    .sw-select-result__item-list {
        border-bottom: 1px solid $color-gray-300;
        padding-bottom: 5px;
        margin-bottom: 5px;

        .sw-select-result__create-new-rule[disabled="disabled"] {
            background: $color-gray-100;
            pointer-events: none;
        }
    }

    .sw-select-result:hover {
        background-color: lighten($color-shopware-brand-500, 40%) !important;
    }

    .sw-select-result {
        margin: 0 5px;
        padding: 5px 16px;
        color: $color-darkgray-200;

        &.has--description {
            padding: 8px 16px;
        }
    }

    .sw-select-result-list__content {
        padding: 8px 0 !important;
    }

    .is--active {
        background: unset !important;
    }
}
